<?php

set_time_limit(0);
date_default_timezone_set('Asia/Bangkok');
include '../../../wp-load.php';

$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE DATE(post_date) = '" . date('Y-m-d') . "' AND post_type='post' AND post_status='publish'");
add_filter('posts_where', 'filter_where');
$condition = array(
    'posts_per_page' => 1,
);
query_posts($condition);
while (have_posts()) : the_post();
    $temp = array(
        'news' => getItemPostNews(),
        'count' => $count,
        'lastid' => get_the_ID(),
        'title' => esc_attr(get_the_title())
    );
    echo json_encode($temp);
    die();
endwhile;
wp_reset_query();
echo array();
?>